package cn.shujuhai.qtadmin.platform.kit;

import org.jetbrains.annotations.NotNull;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.safety.Safelist;

/**
 * @author dch
 */

public class JsoupUtil {

    private static final Safelist WHITELIST = Safelist.basicWithImages();
    private static final Document.OutputSettings OUTPUT_SETTINGS = new Document.OutputSettings().prettyPrint(false);

    static {
        WHITELIST.addAttributes(":all", "style");
    }

    private JsoupUtil() {

    }

    public static @NotNull String clean(String content) {
        return Jsoup.clean(content, Constant.EMPTY, WHITELIST, OUTPUT_SETTINGS);
    }

}
